home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
intrvews
/
xhyper.lha
/
XHyper_v1.1
/
xapp
/
create.c
next >
Wrap
C/C++ Source or Header
|
1992-11-05
|
14KB
|
513 lines
/*
* Generated by the ICS builderXcessory (BX).
*
*
* Builder Xcessory 1.0.1.
*
*/
/*
* REQUIRED MOTIF INCLUDE FILES
*/
#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/ArrowB.h>
#include <Xm/ArrowBG.h>
#include <Xm/BulletinB.h>
#include <Xm/CascadeB.h>
#include <Xm/CascadeBG.h>
#include <Xm/Command.h>
#include <Xm/CutPaste.h>
#include <Xm/DialogS.h>
#include <Xm/DrawingA.h>
#include <Xm/DrawnB.h>
#include <Xm/FileSB.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/LabelG.h>
#include <Xm/List.h>
#include <Xm/MainW.h>
#include <Xm/MenuShell.h>
#include <Xm/MessageB.h>
#include <Xm/PanedW.h>
#include <Xm/PushB.h>
#include <Xm/PushBG.h>
#include <Xm/RowColumn.h>
#include <Xm/Scale.h>
#include <Xm/ScrollBar.h>
#include <Xm/ScrolledW.h>
#include <Xm/SelectioB.h>
#include <Xm/SeparatoG.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>
#include <Xm/ToggleB.h>
#include <Xm/ToggleBG.h>
extern void help_callback();
extern void cancel_callback();
extern void show_panel();
extern void quit_callback();
extern Widget Shell000;
extern Widget Shell001;
extern Widget Shell002;
extern Widget Shell003;
/*
* SOME CONVENIENCE ROUTINES
*/
#ifndef IGNORE_COLOR
static unsigned long
COLOR(w, name)
Widget w;
char *name;
{
XrmValue fromVal, toVal;
unsigned long *pixel;
fromVal.size = sizeof(char*);
fromVal.addr = name;
XtConvert(w, XmRString, &fromVal, XmRPixel, &toVal);
pixel = (unsigned long*)toVal.addr;
if( pixel == NULL )
{
fromVal.addr = XtDefaultBackground;
XtConvert(w, XmRString, &fromVal, XmRPixel, &toVal);
pixel = (unsigned long*)toVal.addr;
}
return(*pixel);
}
#endif
#ifndef IGNORE_FONT
static XmFontList
FONT_LIST(w, name)
Widget w;
char *name;
{
XrmValue fromVal, toVal;
XmFontList *fontListPtr;
fromVal.size = sizeof(char*);
fromVal.addr = name;
XtConvert(w, XmRString, &fromVal, XmRFontList, &toVal);
fontListPtr = (XmFontList*)toVal.addr;
if(fontListPtr == NULL)
{
fromVal.addr = "fixed";
XtConvert(w, XmRString, &fromVal, XmRFontList, &toVal);
fontListPtr = (XmFontList*)toVal.addr;
}
return(*fontListPtr);
}
#endif
#ifndef IGNORE_MENU_POST
static void
MENU_POST(p, m, e)
Widget p;
Widget m;
XButtonEvent *e;
{
Arg args[2];
int argcnt;
int button;
argcnt = 0;
XtSetArg(args[argcnt], XmNwhichButton, &button);
argcnt++;
XtGetValues(m, args, argcnt);
if( e->button != button) return;
XmMenuPosition(m, e);
XtManageChild(m);
}
#endif
#ifndef IGNORE_STRING_TABLE
#include <varargs.h>
static XmString*
STRING_TABLE(va_alist)
va_dcl
{
va_list ap;
int count;
XmString *array;
int i;
va_start(ap);
count = va_arg(ap, int);
array = (XmString*)XtMalloc((count + 1) * sizeof(XmString*));
for(i = 0; i < count; i++ )
{
array[i] = XmStringCreateLtoR(va_arg(ap, char*),
XmSTRING_DEFAULT_CHARSET);
}
array[count] = (XmString)0;
va_end(ap);
return(array);
}
static void
FREE_STRING_TABLE(table)
XmString *table;
{
int i;
for( i = 0; table[i] != 0 ; i++)
{
XmStringFree(table[i]);
}
XtFree(table);
}
#endif
/*
* CALLBACK PROCEDURE DECLARATIONS
*/
Widget
Createmmlpanel(parent)
Widget parent;
{
Arg args[512];
int argcnt;
Widget retval;
XmString xmstr[32];
XmString *xmstrTable[8];
Widget mmlpanel;
XmRegisterConverters();
argcnt = 0;
XtSetArg(args[argcnt], XmNborderWidth, (Dimension)0); argcnt++;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNmessageString, (xmstr[0]=XmStringCreateLtoR(
"This is the MML panel.",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNmessageAlignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNx, 0); argcnt++;
XtSetArg(args[argcnt], XmNy, 0); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 236); argcnt++;
XtSetArg(args[argcnt], XmNheight, 92); argcnt++;
mmlpanel = XtCreateWidget("mmlpanel",
xmMessageBoxWidgetClass,
parent,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(mmlpanel, XmNcancelCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(mmlpanel, XmNokCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(mmlpanel, XmNhelpCallback, help_callback,
(caddr_t)"MML");
retval = mmlpanel;
return( retval );
}
Widget
Createivpanel(parent)
Widget parent;
{
Arg args[512];
int argcnt;
Widget retval;
XmString xmstr[32];
XmString *xmstrTable[8];
Widget ivpanel;
XmRegisterConverters();
argcnt = 0;
XtSetArg(args[argcnt], XmNborderWidth, (Dimension)0); argcnt++;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNmessageString, (xmstr[0]=XmStringCreateLtoR(
"This is the InterViews panel.",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNmessageAlignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNx, 0); argcnt++;
XtSetArg(args[argcnt], XmNy, 0); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 299); argcnt++;
XtSetArg(args[argcnt], XmNheight, 92); argcnt++;
ivpanel = XtCreateWidget("ivpanel",
xmMessageBoxWidgetClass,
parent,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(ivpanel, XmNcancelCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(ivpanel, XmNokCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(ivpanel, XmNhelpCallback, help_callback,
(caddr_t)"InterViews");
retval = ivpanel;
return( retval );
}
Widget
Createxwinpanel(parent)
Widget parent;
{
Arg args[512];
int argcnt;
Widget retval;
XmString xmstr[32];
XmString *xmstrTable[8];
Widget xwinpanel;
XmRegisterConverters();
argcnt = 0;
XtSetArg(args[argcnt], XmNborderWidth, (Dimension)0); argcnt++;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNmessageString, (xmstr[0]=XmStringCreateLtoR(
"This is the X Windows panel.",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNmessageAlignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNx, 0); argcnt++;
XtSetArg(args[argcnt], XmNy, 0); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 290); argcnt++;
XtSetArg(args[argcnt], XmNheight, 92); argcnt++;
xwinpanel = XtCreateWidget("xwinpanel",
xmMessageBoxWidgetClass,
parent,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(xwinpanel, XmNcancelCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(xwinpanel, XmNokCallback, cancel_callback,
(caddr_t)parent);
XtAddCallback(xwinpanel, XmNhelpCallback, help_callback,
(caddr_t)"XWindows");
retval = xwinpanel;
return( retval );
}
Widget Createform(parent) Widget parent;
{
Arg args[512];
int argcnt;
Widget retval;
XmString xmstr[32];
XmString *xmstrTable[8];
Widget form;
Widget xbutton;
Widget ivbutton;
Widget mmlbutton;
Widget quit;
Widget help;
Widget separator;
XmRegisterConverters();
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNx, 0); argcnt++;
XtSetArg(args[argcnt], XmNy, 0); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 358); argcnt++;
XtSetArg(args[argcnt], XmNheight, 118); argcnt++;
form = XtCreateWidget("form",
xmFormWidgetClass,
parent,
args,
argcnt);
retval = form;
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNtopShadowColor, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNbottomShadowColor, COLOR(parent, "black")); argcnt++;
XtSetArg(args[argcnt], XmNleftAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNrightAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNleftOffset, (int)10); argcnt++;
XtSetArg(args[argcnt], XmNrightOffset, (int)10); argcnt++;
XtSetArg(args[argcnt], XmNx, 10); argcnt++;
XtSetArg(args[argcnt], XmNy, 50); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 338); argcnt++;
XtSetArg(args[argcnt], XmNheight, 22); argcnt++;
separator = XtCreateWidget("separator",
xmSeparatorWidgetClass,
form,
args,
argcnt);
XtManageChild(separator);
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNalignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNlabelString, (xmstr[0]=XmStringCreateLtoR(
"Help",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNrecomputeSize, False); argcnt++;
XtSetArg(args[argcnt], XmNtopAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNbottomAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNleftAttachment, XmATTACH_NONE); argcnt++;
XtSetArg(args[argcnt], XmNrightAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNtopOffset, (int)80); argcnt++;
XtSetArg(args[argcnt], XmNbottomOffset, (int)8); argcnt++;
XtSetArg(args[argcnt], XmNleftOffset, (int)230); argcnt++;
XtSetArg(args[argcnt], XmNrightOffset, (int)10); argcnt++;
XtSetArg(args[argcnt], XmNx, 255); argcnt++;
XtSetArg(args[argcnt], XmNy, 80); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 93); argcnt++;
XtSetArg(args[argcnt], XmNheight, 30); argcnt++;
help = XtCreateWidget("help",
xmPushButtonWidgetClass,
form,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(help, XmNactivateCallback, help_callback,
(caddr_t)"Intro");
XtManageChild(help);
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNalignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNlabelString, (xmstr[0]=XmStringCreateLtoR(
"Quit",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNrecomputeSize, False); argcnt++;
XtSetArg(args[argcnt], XmNtopAttachment, XmATTACH_NONE); argcnt++;
XtSetArg(args[argcnt], XmNbottomAttachment, XmATTACH_FORM); argcnt++;
XtSetArg(args[argcnt], XmNtopOffset, (int)90); argcnt++;
XtSetArg(args[argcnt], XmNbottomOffset, (int)10); argcnt++;
XtSetArg(args[argcnt], XmNx, 10); argcnt++;
XtSetArg(args[argcnt], XmNy, 80); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 100); argcnt++;
XtSetArg(args[argcnt], XmNheight, 30); argcnt++;
quit = XtCreateWidget("quit",
xmPushButtonWidgetClass,
form,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(quit, XmNactivateCallback, quit_callback,
(caddr_t)0);
XtManageChild(quit);
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNtopShadowColor, COLOR(parent, "white")); argcnt++;
XtSetArg(args[argcnt], XmNbottomShadowColor, COLOR(parent, "black")); argcnt++;
XtSetArg(args[argcnt], XmNalignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNlabelString, (xmstr[0]=XmStringCreateLtoR(
"X Windows",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNrecomputeSize, False); argcnt++;
XtSetArg(args[argcnt], XmNx, 10); argcnt++;
XtSetArg(args[argcnt], XmNy, 10); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 100); argcnt++;
XtSetArg(args[argcnt], XmNheight, 30); argcnt++;
xbutton = XtCreateWidget("xbutton",
xmPushButtonWidgetClass,
form,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(xbutton, XmNactivateCallback, show_panel,
(caddr_t)Shell002);
XtManageChild(xbutton);
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNalignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNlabelString, (xmstr[0]=XmStringCreateLtoR(
"InterViews",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNrecomputeSize, False); argcnt++;
XtSetArg(args[argcnt], XmNx, 130); argcnt++;
XtSetArg(args[argcnt], XmNy, 10); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 100); argcnt++;
XtSetArg(args[argcnt], XmNheight, 30); argcnt++;
ivbutton = XtCreateWidget("ivbutton",
xmPushButtonWidgetClass,
form,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(ivbutton, XmNactivateCallback, show_panel,
(caddr_t)Shell001);
XtManageChild(ivbutton);
argcnt = 0;
XtSetArg(args[argcnt], XmNbackground, COLOR(parent, "grey")); argcnt++;
XtSetArg(args[argcnt], XmNalignment, XmALIGNMENT_CENTER); argcnt++;
XtSetArg(args[argcnt], XmNlabelString, (xmstr[0]=XmStringCreateLtoR(
"MML",
XmSTRING_DEFAULT_CHARSET))); argcnt++;
XtSetArg(args[argcnt], XmNrecomputeSize, False); argcnt++;
XtSetArg(args[argcnt], XmNx, 250); argcnt++;
XtSetArg(args[argcnt], XmNy, 10); argcnt++;
XtSetArg(args[argcnt], XmNwidth, 100); argcnt++;
XtSetArg(args[argcnt], XmNheight, 30); argcnt++;
mmlbutton = XtCreateWidget("mmlbutton",
xmPushButtonWidgetClass,
form,
args,
argcnt);
XmStringFree( xmstr[0] );
XtAddCallback(mmlbutton, XmNactivateCallback, show_panel,
(caddr_t)Shell000);
XtManageChild(mmlbutton);
return( retval );
}
void help_callback(w, client, call)
Widget w;
caddr_t client;
caddr_t call;
{
extern Display* theDisplay;
if (fork() == 0)
{
close(ConnectionNumber(theDisplay));
execl("../src/XHyper", "XHyper", (char*)client, NULL);
}
}
void cancel_callback(w, client, call)
Widget w;
caddr_t client;
caddr_t call;
{
XtUnrealizeWidget((Widget)client);
}
void show_panel(w, client, call)
Widget w;
caddr_t client;
caddr_t call;
{
XtRealizeWidget((Widget)client);
}
void quit_callback(w, client, call)
Widget w;
caddr_t client;
caddr_t call;
{
XtDestroyWidget(Shell000);
XtDestroyWidget(Shell001);
XtDestroyWidget(Shell002);
XtDestroyWidget(Shell003);
exit(0);
}